//  buka
//
//  Created by 曹飞 on 16/7/5.


#import <UIKit/UIKit.h>
#import "BKUser.h"





typedef NS_ENUM(NSInteger,ModifyType) {
    ModifyTypeAvatar = 0, //头像
    ModifyTypeNickName = 1, //昵称
    ModifyTypeSex = 2, //性别
    ModifyTypeArea = 3,//地区
    ModifyTypeuserExtends = 4,//简介
};



@interface RootClass : NSObject <NSKeyedUnarchiverDelegate>

@property (nonatomic, strong) NSString * token;
@property (nonatomic, strong) NSString * device;

@property (nonatomic,strong) NSString * expire;
@property (nonatomic,strong) NSString* num_type;
@property (nonatomic,strong) NSString * user_area_id;
@property (nonatomic,strong) NSString * user_avatar_url;
@property (nonatomic,strong) NSString * user_birthday;
@property (nonatomic,strong) NSString * user_extends;
@property (nonatomic,strong) NSString * user_id;
@property (nonatomic,strong) NSString * user_nickname;
@property (nonatomic,strong) NSString * user_phone_num;
@property (nonatomic,strong) NSString * user_sex_id;
@property (nonatomic,strong) NSString * connect_email;
@property (nonatomic,strong) NSString * flag_password; //0表示还没密码，1表示有密码
@property (nonatomic,strong) NSString * home_page_name;

@property (nonatomic, strong) BKUser * user;




/**

-(instancetype)initWithDictionary:(NSDictionary *)dictionary;

-(NSDictionary *)toDictionary;

*/


/**
 *  返回用户实体
 *
 *  @return RootClass 用户实体
 */
+(RootClass *)rootEntity;

/**
 *  存储用户实体
 */
-(void)saveRoot;

-(void)adepte:(RootClass*)root;

-(void)deleteRoot;


//登陆
-(void)sign:(NSString *)userName
    withPwd:(NSString *)pwd
     device:(NSString*)device
    ctrlBtn:(UIButton *)loginBtn
      block:(void(^)(RootClass * root, NSError *error))block;


/**
 *  退出登陆操作
 *
 *  @param block 退出登录回调，isLogout ＝ YES 退出成功，NO 退出失败，返回错误
 */
-(void)logout:(void (^)(BOOL isLogout,NSError * error))block;


/**
 *  修改个人信息
 *
 *  @param type ModifyType
 *  @see ModifyType
 *  @param modifyStr 需要修改的字符串 ，例如头像就是头像地址
 *  @param block 修改回调
 */
-(void)modifyInfo:(ModifyType)type
     withParamStr:(id)modifyStr
        withBlock:(void (^)(NSString * resurltJson,NSError * error))block;

@end
